export function recursionRouter(userRouter = [], allRouter = []) {
    var realRouter = [];
    allRouter.forEach((v, i) => {
        userRouter.forEach((item) => {
            if (item.name === v.name) {
                if (item.children && item.children.length > 0) {
                    v.children = recursionRouter(item.children, v.children)
                }
                realRouter.push(v);
            }
        })
    })
    return realRouter;
}

export function setDefaultRoute(routes) {
    routes.forEach((v, i) => {
        if (v.children && v.children.length > 0) {
            v.redirect = {name: v.children[0].name}
            setDefaultRoute(v.children);
        }
    })
}
